package service.impl;

import dao.LikesDao;
import dao.impl.LikesDaoImpl;
import pojo.Likes;
import service.LikesService;

import java.sql.SQLException;
import java.util.ArrayList;

public class LikesServiceImpl implements LikesService {
    private LikesDao likesDao = new LikesDaoImpl();
    private boolean b = false;

    public ArrayList<Likes> likes(Integer uid) throws SQLException, ClassNotFoundException {
        ArrayList<Likes> likesList = new ArrayList<>();
        likesList = likesDao.likesList(uid);
        return likesList;
    }


    public boolean UserLikeNote(Integer uid, Integer nid) throws SQLException {
        b = likesDao.UserLikeNote(uid, nid);
        return b;
    }


    public Integer noteLikes(Integer nid) throws SQLException {
        Integer number = 0;
        number = likesDao.noteLikes(nid);
        return number;
    }

    public boolean UserUnlikeNote(Integer uid, Integer nid) throws SQLException {
        b = likesDao.UserUnlikeNote(uid, nid);
        return b;
    }

}
